#include "Shm.hpp"
#include "NamedPipe.hpp"

int main()
{
    // 1.创建共享内存
    Shm shm(gpathname, gproj_id, User);
    shm.Zero();
    char *shmaddr = (char *)shm.Addr();

    // 2.创建管道
    NamedPipe fifo(comm_path, User);
    fifo.OpenForWrite();

    // test01
    sleep(3);
    char ch = 'A';
    while (ch <= 'Z')
    {
        shmaddr[ch - 'A'] = ch;
        string temp = "wakeup";
        cout << "add: " << ch << " into shm, " << "wakeup reader " << endl;
        ch++;
        fifo.WriteNamedPipe(temp);
        sleep(2);
    }

    return 0;
}